package com.yc.yyds.servlet;

import com.google.gson.Gson;
import com.yc.yyds.Bean.Result;
import com.yc.yyds.util.DBHelper;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet(name = "RemoveIndentServlet", value = "/RemoveIndentServlet.s")
public class RemoveIndentServlet extends HttpServlet {
    private  void remove(String indentid){
        String sql="delete from indent where indentid=?";
        DBHelper.update(sql,indentid);
    }
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String indentid = request.getParameter("indentid");
        remove(indentid);
        String json = new Gson().toJson(new Result(1, "删除成功", null));
        response.getWriter().append(json);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
